$(document).ready(function(){
var	code = document.documentElement.outerHTML,
	s = new RegExp('<|>','g'),
	r = function(c){
		return (c=='<')?'&lt;':'&gt;'
	},
	rstyle = function(s){
		var style = new RegExp('adblock|livejournal|facebook','gim')
		return	s.search(style)>=0?'':s
	},
	js	=new RegExp('\n?[\f\r\t\v]*<script[^>]*?src="[^">]*?(showpagecode|prettify|clickToActivate)+[^">]*?"[^>]*?>.*?<\/script>','gim'),
	link	=new RegExp('\n?[\f\r\t\v]*<link[^>]*?href="[^">]*?(prettify)+[^">]*?"[^>]*?>','gim'),
	meta	=new RegExp('\n?[\f\r\t\v]*<meta[^>]*?>','gim'),
	style	=new RegExp('\n?[\f\r\t\v]*<style[^>]*>(.|\n)*?</style>','gim')
if(typeof(code)!='string')
	code = document.documentElement.innerHTML
$('body').append('<div class="code"><span class="showcode opened">Show this page code</span></div>')
$('.showcode').live('click',function(){
	if($('.code>.prettyprint').length==0){
		$(this).text('Hide this page code')
		code=code
		.replace(style,rstyle)
		.replace(js,'')
		.replace(link,'')
		.replace(meta,'')
		$('.code').append('<pre class="prettyprint lang-html linenums">'+code.replace(s,r)+'</pre>').hide().slideDown(400)
		$('html,body').css('overflow-y','hidden')
		prettyPrint()
	}else if($(this).is('.closed')){
		$(this).text('Hide this page code')
		$(this).addClass('opened').removeClass('closed')
		$('.code > .prettyprint').stop(true).slideDown(400)
		$('html,body').css('overflow-y','hidden')
	}else if($(this).is('.opened')){
		$(this).text('Show this page code')
		$(this).addClass('closed').removeClass('opened')
		$('.code > .prettyprint').stop(true).slideUp(400)
		$('html,body').css('overflow-y','auto')
	}
})
return true
})